const Throttle = (fn, delay = 3000) => {
    // 定时器
    let timer = null
    return function () {
    // 保留调用时的this
      const that = this
      // 保留调用时传入的参数
      const args = arguments
      // 等到了delay才能执行并清空定时器
      if (!timer) {
        timer = setTimeout(function() {
            timer = null
            fn.apply(that, args)
        },delay);
      }
      // 设立新的定时器
      timer = setTimeout(function () {
        fn.apply(that, args)
      }, delay)
    }
  }
  export default Throttle
  